package com.dnjn.happiness.survey.controller.admin;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dnjn.happiness.common.core.utils.bean.BeanUtils;
import com.dnjn.happiness.common.core.utils.poi.ExcelUtil;
import com.dnjn.happiness.common.log.annotation.Log;
import com.dnjn.happiness.common.log.enums.BusinessType;
import com.dnjn.happiness.common.security.annotation.RequiresPermissions;
import com.dnjn.happiness.survey.controller.common.CommonCheckAnswerController;
import com.dnjn.happiness.survey.domain.CheckAnswer;
import com.dnjn.happiness.survey.domain.vo.CheckAnswerVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 考核答案Controller
 *
 * @author happiness
 * @date 2024-04-03
 */
@Tag(name = "check admin answer 考核答案" , description = "考核答案" )
@RestController
@RequestMapping("/admin/check/answer" )
public class AdminCheckAnswerController extends CommonCheckAnswerController {
    /**
     * 导出考核答案列表
     */
    @Log(title = "考核答案" , businessType = BusinessType.EXPORT)
    @RequiresPermissions("@ss.hasPermi('check:answer:export')" )
    @PostMapping("/export" )
    public void export(HttpServletResponse response, CheckAnswerVO vo) {
        CheckAnswer checkAnswer=new CheckAnswer();
        BeanUtils.copyPropsIgnoreNull(vo,checkAnswer);

        List<CheckAnswer> list = checkAnswerService.list(Wrappers.query(checkAnswer));
        ExcelUtil<CheckAnswer> util = new ExcelUtil<CheckAnswer>(CheckAnswer. class);
        util.exportExcel(response, list, "考核答案数据" );
    }



}
